﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using log4net;

namespace Quartz.JobClass
{
    public class LogHelper
    {
        private static ILog _logger = null;
        static LogHelper() 
        {
            log4net.Config.XmlConfigurator.Configure();
        }
        protected static ILog Logger
        {
            get
            {
                if (_logger == null)
                {
                    _logger = log4net.LogManager.GetLogger("GSC_Agent.Logger");
                }

                return _logger;
            }
        }

        public static void Error(string msg)
        {
            Logger.Error(msg);
        }

        public static void Error(string format, params object[] ps)
        {
            Logger.ErrorFormat(format, ps);
        }

        public static void Info(string msg)
        {
            Logger.Info(msg);
        }

        public static void Info(string format, params object[] ps)
        {
            Logger.InfoFormat(format, ps);
        }

        //public static void Error(string msg)
        //{
        //    File.AppendAllText(".\\log\\error.txt",DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff ")+msg+"\r\n");
        //}

        //public static void Info(string msg)
        //{
        //    File.AppendAllText(".\\log\\" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff ") + msg+"\r\n");
        //}
    }
}
